<template>
  <!-- <div>eshop</div> -->
   <van-sticky>
  <van-nav-bar
  :title="route.meta.title"
  :left-text="!isHomePage ? '返回' : ''" 
  :left-arrow="!isHomePage"
  :style="{
    '--van-nav-bar-background': '#228DFF',
    '--van-nav-bar-icon-color': 'white',
    '--van-nav-bar-title-text-color': 'white',
    '--van-nav-bar-text-color': 'white'
  }"
  @click-left="onClickLeft"
  ></van-nav-bar>
  </van-sticky>

  <transition name="fade" mode="out-in">
    <router-view></router-view>
  </transition>

  <tabbar></tabbar>
  <!-- <van-button type="success">hello</van-button>
  <van-button type="danger">hello</van-button> -->
</template>

<script setup>
import tabbar from '@/components/tabbar.vue'
import { useRoute }  from 'vue-router';
import { computed } from 'vue';

import { login } from "@/api/login";
import { onMounted } from 'vue';
import { windowWidth } from 'vant/lib/utils';
const route = useRoute();
const isHomePage = computed(() => {
return route.path == '/home'
});
const onClickLeft = () => history.back();
onMounted(async()=>{
  const data = {username:'2206040118',password:'123456'}
  const res = await login(data)
  console.log(res);
})




</script>

<style scoped>

.fade-enter-from {
opacity: 0;
transform: translateX(100%)
}
.fade-leave-to {
opacity: 0;
transform: translateX(-100%);
position: absolute;
}
.fade-enter-active, .fade-leave-active {
transition:all 0.5s ease;
}
</style>